package com.ml.doctor.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.ml.doctor.R;
import com.ml.doctor.bean.JianCeBean;
import com.ml.doctor.view.CycleImageView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class JianCeDetailActivity extends BaseActivity {

    @BindView(R.id.iv_avatar)
    CycleImageView ivAvatar;
    @BindView(R.id.txt_name)
    TextView txtName;
    @BindView(R.id.txt_sex)
    TextView txtSex;
    @BindView(R.id.txt_age)
    TextView txtAge;
    @BindView(R.id.txt_wd)
    TextView txtWd;
    @BindView(R.id.txt_xl)
    TextView txtXl;
    @BindView(R.id.txt_mb)
    TextView txtMb;
    @BindView(R.id.txt_xt)
    TextView txtXt;
    @BindView(R.id.txt_xy)
    TextView txtXy;
    @BindView(R.id.txt_xya)
    TextView txtXya;
    @BindView(R.id.txt_dgc)
    TextView txtDgc;
    @BindView(R.id.txt_xns)
    TextView txtXns;
    @BindView(R.id.txt_zd)
    TextView txtZd;
    @BindView(R.id.txt_yz)
    TextView txtYz;
    JianCeBean jianCeBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jian_ce_detail);
        ButterKnife.bind(this);
        setTopTitle("体检数据");
        init();
        setupView();
    }

    private void init() {
        jianCeBean = getSerializableParam("jiance", JianCeBean.class);
    }

    private void setupView() {
        Glide.with(this).load(jianCeBean.getUser().user_photo).asBitmap().into(ivAvatar);
        txtName.setText(jianCeBean.getBname());
        txtSex.setText(jianCeBean.getUser().sex);
        txtAge.setText(jianCeBean.getUser().age + "岁");
        txtWd.setText(jianCeBean.getTemper_ature() + " ℃");
        txtXl.setText(jianCeBean.getHeart_rate() + "");
        txtMb.setText(jianCeBean.getPulse() + "");
        txtXt.setText(jianCeBean.getBlood_sugar() + "");
        txtXy.setText(jianCeBean.getBlood_oxygen() + "");
        txtXya.setText(jianCeBean.getLow_pressure() + "-" + jianCeBean.getHigh_pressure());
        txtDgc.setText(jianCeBean.getCholesterol() + "");
        txtXns.setText(jianCeBean.getUric_acid() + "");
        if (TextUtils.isEmpty(jianCeBean.getDiagnosis()))
            txtZd.setText("无诊断");
        else
            txtZd.setText(jianCeBean.getDiagnosis() + "");
        if (TextUtils.isEmpty(jianCeBean.getYz()))
            txtYz.setText("无医嘱");
        else
            txtYz.setText(jianCeBean.getYz() + "");
    }
}
